package com.alex.common.message;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 崔磊订单消息实体类
 * 用于在各个服务之间传递订单信息
 */
public class CuileiOrderMessage implements Serializable {
    private String orderId;           // 订单ID
    private String userId;            // 用户ID
    private String productName;       // 商品名称
    private BigDecimal amount;        // 订单金额
    private String status;            // 订单状态
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime; // 创建时间

    // 构造函数
    public CuileiOrderMessage() {
        this.createTime = LocalDateTime.now();
    }

    public CuileiOrderMessage(String orderId, String userId, String productName,
                              BigDecimal amount, String status) {
        this();
        this.orderId = orderId;
        this.userId = userId;
        this.productName = productName;
        this.amount = amount;
        this.status = status;
    }

    // Getter和Setter方法
    public String getOrderId() { return orderId; }
    public void setOrderId(String orderId) { this.orderId = orderId; }

    public String getUserId() { return userId; }
    public void setUserId(String userId) { this.userId = userId; }

    public String getProductName() { return productName; }
    public void setProductName(String productName) { this.productName = productName; }

    public BigDecimal getAmount() { return amount; }
    public void setAmount(BigDecimal amount) { this.amount = amount; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    public LocalDateTime getCreateTime() { return createTime; }
    public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }


    @Override
    public String toString() {
        return "CuileiOrderMessage{" +
                "orderId='" + orderId + '\'' +
                ", userId='" + userId + '\'' +
                ", productName='" + productName + '\'' +
                ", amount=" + amount +
                ", status='" + status + '\'' +
                ", createTime=" + createTime +
                '}';
    }

}
